<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="解约协议编号" prop="sfTerminationNo" label-width="100">
        <el-input
          v-model="queryParams.sfTerminationNo"
          placeholder="请输入解约协议编号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="小区名称" prop="premiseName" label-width="100">
        <el-input
          v-model="queryParams.premiseName"
          placeholder="请输入小区名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item><br>
      <el-form-item label="录入人" prop="inputUserName" label-width="100">
        <el-input
          v-model="queryParams.inputUserName"
          placeholder="请输入录入姓名"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>


      <el-form-item label="协议录入日期" prop="inputDate" label-width="100">
        <el-date-picker clearable size="small"
                        v-model="queryParams.inputDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择录入日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="terminationList">
      <el-table-column label="解约协议编号" align="center" prop="sfTerminationNo" />
      <el-table-column label="小区" align="center" prop="premiseName" />
      <el-table-column label="解约类型" align="center" prop="terminationType">
        <template slot-scope="scope">
          <span v-if="scope.row.terminationType==1">合同到期</span>
          <span v-if="scope.row.terminationType==2">业主提前解约</span>
          <span v-if="scope.row.terminationType==3">我方退租解约</span>
          <span v-if="scope.row.terminationType==4">其他</span>
        </template>
      </el-table-column>

      <el-table-column label="解约日期" align="center" prop="terminationDate" width="180">

      </el-table-column>

      <el-table-column label="审核日期" align="center" prop="auditDate" width="180">

      </el-table-column>

      <el-table-column label="结算金额" align="center" prop="finalStatement" />
      <el-table-column label="录入日期" align="center" prop="inputDate" width="180"/>
      <el-table-column label="操作人" align="center" prop="inputUserName"/>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

  </div>
</template>

<script>
import { listTermination, getTermination, delTermination, addTermination, updateTermination } from "@/api/houseClosing/termination";

export default {
  name: "Termination",
  components: {
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 【请填写功能名称】表格数据
      terminationList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        sfTerminationNo: null,
        inputDate: null,
        inputUserName:null,
        premiseName:null

      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询【请填写功能名称】列表 */
    getList() {
      this.loading = true;
      listTermination(this.queryParams).then(response => {
        this.terminationList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
  }
};
</script>
